<?php 
	namespace Admin\Model;
	//use \Think\Model;
	class AdminUserModel extends \Think\Model{
		protected $_validate=array(
			array('username','require','用户名不能为空'),
			array('pwd','require','密码不能为空')
			);
		//自动完成
		protected $_auto=array(
			array('pwd','md5',3,'function'),
			array('status',1),
			array('addtime','time',1,'function')
			);
		public function getAll(){
			//获取所有的数据
			$userlist=$this->select();
			return $userlist;
		}
		//查询条件
		public function getFind($data){
			$where='';
			//处理data
			foreach ($data as $key => $value) 
			{
				$where.="`$key`='$value' AND ";
			}
			$where=trim($where,' AND ');
			$res=$this->where("$where")->find();
			if ($res==null) 
			{
				return false;
			}else{
				return $res;
			}

		}
	}

?>